package com.newly.api.business.feign;

import com.newly.common.base.constants.ServerUriConstant;
import com.newly.common.base.entity.R;
import com.newly.common.base.entity.business.Dto.SiteDto;
import com.newly.common.base.entity.business.Po.Site;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * @anthor sbq
 * @date 2021/10/26 11:29
 */
@Api(tags = "站点信息管理api")
@FeignClient(path = ServerUriConstant.NEWLY_BUSINESS_SITE, name = ServerUriConstant.NEWLY_BUSINESS_SERVICE_NAME)
public interface SiteClient {

    @ApiOperation("导出站点信息表")
    @GetMapping("/export")
    void export(@RequestParam(value = "name", required = false) String name,
                @RequestParam(value = "id", required = false) String id,
                @RequestParam(value = "type", required = false) Integer type,
                HttpServletResponse response);

    @ApiOperation("分页查询站点列表")
    @GetMapping("/getPage")
    R getPage(SiteDto siteDto);

    @ApiOperation("根据id查询基础信息和违法历史记录")
    @GetMapping("/getDetailsById")
    R getDetailsById(@RequestParam(value = "id", required = false) Long id,
                     @RequestParam(value = "offset", required = false) Integer offset);

    @ApiOperation("编辑站点信息")
    @PostMapping("/edit")
    R edit(@Valid @RequestBody Site site);


    @ApiOperation("保存一条记录")
    @PostMapping("/save")
    R save(@Valid @RequestBody Site site);

    @ApiOperation("批量删除")
    @PostMapping("/delete")
    R delete(@RequestBody Long[] ids);

    @ApiOperation("查询所有站点名称")
    @GetMapping("/getSiteNames")
    R getSiteNames();

    @ApiOperation("获取所有站点名称与id的键值对")
    @GetMapping("/getSiteNameAndId")
    R getSiteNameAndId();

    @ApiOperation("站点名称是否重复")
    @GetMapping("/repeat")
    R repeat(@RequestParam(value = "siteName", required = false) String siteName);

    @ApiOperation("通过id查询站点信息")
    @GetMapping("/queryByIdsInAuth")
    R queryByIdsInAuth(@RequestParam("siteIds") List<String> siteIds);
}
